from rest_framework import serializers

from goods.search_indexes import SKUIndex
from .models import SKU
from drf_haystack.serializers import HaystackSerializer


class SKUSerializers(serializers.ModelSerializer):
    class Meta:
        model = SKU
        fields = '__all__'


class SKUSearchSerializers(HaystackSerializer):
    object = SKUSerializers()

    class Meta:
        index_classes = [SKUIndex]
        fields = ('txt', 'object')
